package com.grass.finding.model.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.models.auth.In;
import lombok.Data;

/**
 * 帖子评论
 * @TableName comments
 */
@TableName(value ="comments")
@Data
public class Comments implements Serializable {
    /**
     * 评论Id
     */
    @TableId(value = "commentId", type = IdType.AUTO)
    private Integer commentId;

    /**
     * lost表的主键
     */
    @TableField(value = "lostId")
    private Integer lostId;

    /**
     * user表主键
     */
    @JsonIgnore
    @TableField(value = "openId")
    private String openId;

    @TableField(exist = false)
    private String userName;
    @TableField(exist = false)
    private String userAvatar;
    @TableField(exist = false)
    private String replyUsername;

    /**
     * 前端展示时添加的新字段，可以快速定位到list数组的内容
     */
    @TableField(exist = false)
    private Integer index;
    /**
     * 创建时间
     */
    @TableField(value = "creatTime")
    private Date creatTime;

    /**
     * 评论内容
     */
    @TableField(value = "commentBody")
    private String commentBody;

    /**
     * 更新时间
     */
    @TableField(value = "updateTime")
    private Date updateTime;

    /**
     * 回复的谁的评论
     */
    @TableField(value = "replyId")
    private Integer replyId;

    /**
     * 评论所属评论id
     */
    @TableField(value = "parentId")
    private Integer parentId;
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        com.grass.finding.model.domain.Comments other = (com.grass.finding.model.domain.Comments) that;
        return (this.getCommentId() == null ? other.getCommentId() == null : this.getCommentId().equals(other.getCommentId()))
                && (this.getLostId() == null ? other.getLostId() == null : this.getLostId().equals(other.getLostId()))
                && (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId()))
                && (this.getCreatTime() == null ? other.getCreatTime() == null : this.getCreatTime().equals(other.getCreatTime()))
                && (this.getCommentBody() == null ? other.getCommentBody() == null : this.getCommentBody().equals(other.getCommentBody()))
                && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
                && (this.getReplyId() == null ? other.getReplyId() == null : this.getReplyId().equals(other.getReplyId()))
                && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCommentId() == null) ? 0 : getCommentId().hashCode());
        result = prime * result + ((getLostId() == null) ? 0 : getLostId().hashCode());
        result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode());
        result = prime * result + ((getCreatTime() == null) ? 0 : getCreatTime().hashCode());
        result = prime * result + ((getCommentBody() == null) ? 0 : getCommentBody().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getReplyId() == null) ? 0 : getReplyId().hashCode());
        result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", commentId=").append(commentId);
        sb.append(", lostId=").append(lostId);
        sb.append(", openId=").append(openId);
        sb.append(", creatTime=").append(creatTime);
        sb.append(", commentBody=").append(commentBody);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", replyId=").append(replyId);
        sb.append(", parentId=").append(parentId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}